import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

export const constantRouterMap = 
    [
        {
          path: '/login',
          name: 'login',
          component: resolve => require(['@/views/Login'],resolve),
          meta:{
              title:'登录',
              roles:['admin','editor']
          }
        },
        {
            path:'/',
            name:'home',
            component: resolve => require(['@/views/Home'],resolve),
            meta:{
                title:'首页',
                roles:['admin','editor']
            }
        },
        {
            path:'/error',
            name:'error',
            component:resolve => require(['@/views/ErrorPage'],resolve),
            meta:{
                title:'错误',
                roles:['admin','editor']
            }
        }
      ]


export const asyncRouterMap = [
    {
        path: '/permission',
        name:'permission',
        component: resolve => require(['@/views/Permission'],resolve),
        meta:{
            title:'权限',
            roles:['admin']
        }
    }
]

export default new Router({
  routes: constantRouterMap
})
